package com.cuckoo.mall.thus.menuaccount.ticket;


import android.support.v7.widget.LinearLayoutManager;
import android.view.LayoutInflater;
import android.view.View;

import com.bgn.baseframe.base.BaseListFragment;
import com.bgn.baseframe.base.MVPBaseFragment;
import com.bgn.baseframe.utils.decoration.CommonDecoration;
import com.chad.library.adapter.base.BaseQuickAdapter;
import com.cuckoo.mall.R;
import com.cuckoo.mall.javabean.Goods;
import com.cuckoo.mall.javabean.Ticket;

import java.util.List;

/**
 * MVPPlugin
 * 邮箱 784787081@qq.com
 */

public class TicketFragment extends BaseListFragment<TicketContract.View, TicketPresenter, Ticket> implements TicketContract.View {

    @Override
    protected int getLaoutResouse() {
        return R.layout.fragment_ticket_list;
    }

    @Override
    protected BaseQuickAdapter setAdapter() {
        adapter = new TicketListAdapter(datas);
        return adapter;
    }

    @Override
    protected void setLayoutManage() {
        recycleView.setLayoutManager(new LinearLayoutManager(getBaseActivity()));
        recycleView.addItemDecoration(new CommonDecoration(15));
    }

    @Override
    protected void onRefreshData() {

    }

    @Override
    protected void initListData() {
        showLoadingView();
        mPresenter.getAllTicket();
    }

    @Override
    protected void loadMoreData() {

    }

    @Override
    protected boolean shoudOpenLoadMore() {
        return false;
    }

    @Override
    protected boolean shoudOpenRefresh() {
        return false;
    }

    @Override
    public void whenGetTicket(List<Ticket> ticketList) {

        if (ticketList != null && ticketList.size() == 0) {
            showNoDataDefaultView(R.mipmap.no_ticket,R.string.no_ticket2);
        } else {
            handleData(ticketList, 1);
        }
    }

    @Override
    public void initFaild(String message) {
        showErrorDefaultView(message);
    }

}
